<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>

  <script type="text/javascript">
    var users = [{
        'user': '小红',
        'active': false
      },
      {
        'user': '小明',
        'active': false
      },
      {
        'user': '小白',
        'active': true
      }
    ];

    var target = {
      'user': '小明'
    };

    // users里面找target，返回对应下标

   users.push(target)
   for(let i = 0; i<users.length; i++){
     if(users[i].user == '小明' && users[i].active !=false){
       console.log(users[i].user + i)
     }
   }




  </script>
</body>

</html>